package com.mvcMovie.service.impl;

import com.mvcMovie.bean.Movie;
import com.mvcMovie.mapper.MovieMapper;
import com.mvcMovie.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MovieImpl implements MovieService {

    @Autowired
    private MovieMapper movieMapper;
    @Override
    public List<com.mvcMovie.bean.Movie> getAllMovie() {
        return movieMapper.selectAllMovie();
    }

    @Override
    public Movie selectById(Integer id) {
        return movieMapper.selectById(id);
    }

    @Override
    public Movie getMovie(Integer id) {
        return movieMapper.selectByIdtoMovieRecord(id);
    }

    @Override
    public Integer updateMovie(String movieName, Double movieScore, Integer id) {
        return movieMapper.updateById(movieName,movieScore,id);
    }

    @Override
    public Integer deleteMovie(Integer id) {
        return movieMapper.deleteById(id);
    }

    @Override
    public Integer addMovie(Movie movie) {
        return movieMapper.insertMovie(movie);
    }


}
